// Render a link for viewing events occuring on the same day in eventful.
// version 1.0
// 2006-07-08
// Copyright (c) 2006, Calvin Yu
//
// --------------------------------------------------------------------
//
// This is a Tails script.
//
// To install, you need Tails: http://blog.codeeg.com/tails-firefox-extension/
// Then restart Firefox and revisit this script and click on 'Install'.
//
// To uninstall, go to Tools/Manage Tails Scripts...,
// select "Map with Google", and click Uninstall.
//
// --------------------------------------------------------------------
//
// ==TailsScript==
// @name          Other Events that Day
// @namespace     http://blog.codeeg.com/tails
// @description   Render a link for viewing events occuring on the same day in eventful.
// @include       hcalendar
// ==/TailsScript==

getURL: function() {
  if (this.object.location_hcard && this.object.dtstart_date) {
    var hcard = this.object.location_hcard;
    if ((hcard.locality && hcard.region) || hcard['postal-code']) {
      var location = hcard.toLocalityRegionAndCountryString();
      var dt = this.object.dtstart_date;

      return "http://eventful.com/events?page_size=15&sort_order=Date&within=25&units=miles&display=Medium&q=&l="
          + location + "&t=" + (dt.getMonth()+1) + "/" + dt.getDate() + "/" + dt.getFullYear() + "&c=";
    }
  }
}
